package com.ch.home.testMapper;

import com.ch.home.bean.DishCustom;
import com.ch.home.mapper.restDishMapper.DishCustomMapper;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.LinkedList;

/**
 * Created by CHEN on 2019/8/27.
 */
@RunWith(SpringRunner.class)
@SpringBootTest
public class testDishCustomMapper {

    @Autowired
    DishCustomMapper dishCustomMapper;


    @Test
    public void testGetDishCustom(){
        DishCustom dishCustom = new DishCustom(3, 2, "每周吃一次", null, null);
        System.out.println( dishCustomMapper.getDishCustom(dishCustom));
    }



    @Test
    public void testGetDishCustomAndSource(){

        LinkedList<DishCustom> dishCustomAndSource = dishCustomMapper.getDishCustomAndSource(new DishCustom(null, 1, null, null, null));

        for (DishCustom d:dishCustomAndSource
             ) {
            System.out.println("------------------------------------");
            System.out.println(d );
        }
    }


    @Test
    public void testAddDishCustom(){
        DishCustom dishCustom = new DishCustom(null, 2, "每周吃一次", null, null);
        int i = dishCustomMapper.addDishCustom(dishCustom);
        System.out.println(dishCustom );
        System.out.println("------------------------------" );
        System.out.println(i );
    }

    @Test
    public void testUpdateDishCustom(){
        DishCustom dishCustom = new DishCustom(3, 2, "刚刚说错了，很好吃很好吃~~~~", null, null);


        int i = dishCustomMapper.updateDishCustom(dishCustom);
        System.out.println(i );


    }


}
